<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
<meta charset="UTF-8"/>
<title>运营平台</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="renderer" content="webkit">
<!--<meta http-equiv="X-UA-Compatible" content="IE=edge">-->
<link type="text/css" rel="stylesheet" href="<?php echo get_style_cdnurl();?>paimai/yunying/css/common.css?v=20170207" />
<link type="text/css" rel="stylesheet" href="<?php echo get_style_cdnurl();?>paimai/yunying/css/table.css?v=20170117" />
<link type="text/css" rel="stylesheet" href="<?php echo get_style_cdnurl();?>paimai/yunying/css/jquery-ui.css" />
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery-1.11.1.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery-ui.min.js" type="text/javascript"></script>
 <script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/yunIndex.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery-ym-datePlugin-0.1.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/global.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/cheshan/js/common.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery.placeholder.min.js"></script>
<script type="text/javascript">
 $(function(){
     $("input").placeholder();
     if (navigator.userAgent.indexOf("Safari") > -1) {
       $("input").css("lineHeight","normal !important");
     };
});
</script>

<style type="text/css">
    .focus-btn,.new_carousel_btn{width:80px;border-radius: 3px;color: #fff;margin-left: 7px;padding: 0;background-color: #20ab4f;border: medium none;}
    .chenggong1 .paidan{padding-top:30px;}
    .paidan h3{font-size:16px;color:#000;margin-bottom: 30px;}
    .carousel{margin:12px 0}
    #platform{
         -moz-appearance: none;background: rgba(0, 0, 0, 0) url("<?php echo get_style_cdnurl();?>/paimai/yunying/images/sanjiao.jpg") no-repeat scroll 130px 5px;border: 1px solid #d7d7d7;color: #666;float: left;
    font-family: "微软雅黑";height: 26px;line-height: 26px;margin: 0 10px 10px 0;text-align: left;width: 154px;
    }
</style>
</head>
<body>
<div class="header">
<div class="headerCo">
<span>你好,<?php echo ($user_info["real_name"]); ?><a href="<?php echo (WEB_URL); ?>Emp/logout">退出</a></span>
<h1><img src="<?php echo get_style_cdnurl();?>paimai/yunying/images/yun_logo.jpg"></h1>
</div>
</div>
<div class="mian">
    <div class="mianL">
    <dl>
        <dd>
            <a id="menu_sy" href="/Index/index" class="shouye">首页</a>
        </dd>
        <?php foreach ($tree_menu as $key => $value): ?>
          <dd>
            <span id="menu_<?php echo ($value['first_char']); ?>" ><img src="<?php echo get_style_cdnurl();?>paimai/yunying/images/yun_jia.jpg"><?php echo ($value['name']); ?></span>
            <ul style="display: none;">
                <?php if (!empty($value['children'])): ?>
                    <?php foreach ($value['children'] as $k => $v): ?>
                        <li><a id='menu_<?php echo ($v["first_char"]); ?>' href="<?php echo ($v['url']); ?>"><?php echo ($v['name']); ?></a></li>
                    <?php endforeach ?>
                <?php endif ?>
            </ul>
        <?php endforeach ?>
    </dl>
</div>

<?php $menu = 'nrgl.jdtgl'; ?>
<?php $menu=json_encode(explode('.', $menu)); ?>
<script>
    $(function () {
        var cur_menu = '<?php echo ($menu); ?>', cur_menu = eval('[' + cur_menu + ']'), cur_menu = cur_menu[0];
        if (cur_menu == "sy") {
            $("#menu_sy").removeClass('shouye').addClass('current');
        }
        $('#menu_' + cur_menu[0]).click();
        $('#menu_' + cur_menu[0]).find("img").attr("src", "http://img1.isou365.cn/paimai/yunying/images/yun_jie.jpg");
        $(".mianL").css("height", $(document).height() - 95);
        $('#menu_' + cur_menu[1]).addClass('current');
    });
</script>

    <div class="mianR">
        <div class="yuyue">
            <ul>
                <li onclick="get_list(1)" class="yuCurrent">来拍车APP</li>
                <!--<li onclick="get_list(2)">车来车往APP</li>-->
                <!--<li onclick="get_list(3)">车来车往WEB</li>-->
            </ul>
        </div>
        
        <div class='carousel clearfix'>
            <form id="searchFrom">
                <input type="hidden" id="platform_type" name="platform_type" value="">
                <input type="text" name="c_id" placeholder="请输入编号" class=""/>
                <input type="text" name="remark" placeholder="请输入标题" class=""/>
                <select name="type" id="carousel_type">
                    <option value="">全部类型</option>
                    <option value="1">拍卖</option>
                    <option value="2">活动</option>
                    <option value="3">图片</option>
                </select>
                <input type="text" name="start_time" placeholder="开始时间" value="" class="xiaci xin-text1" id="carousel_start_time" readonly>
                <input type="text" name="end_time"  placeholder="结束时间" value="" class="xiaci xin-text1" id="carousel_end_time" readonly />
                <input type="text" name="sort" placeholder="请输入排序" class=""/>
                <select name="status" id="carousel_status">
                    <option value="">全部状态</option>
                    <option value="1">已上线</option>
                    <option value="2">已下线</option>
                </select>
<!--                <select name="platform" id="platform">
                    <option value="">请选择平台</option>
                    <option value="1">来拍车APP</option>
                    <option value="2">车来车往APP</option>
                    <option value="3">车来车往WEB</option>
                </select>-->
                <input type="button" value="筛选" name="focus_search" class="focus-btn"  />
            </form>
            <div style="float:left;width:100%;height:30px;padding-top: 8px;">
                <input type="button" value="新建焦点图" id="create_new_carousel" class="new_carousel_btn" style="float:left;"/>
            </div>
        </div>
        <div class="yunBei"></div>
        <div class="yuList">
            <div class="listBox" id="listBox"></div>
        </div>
    </div>
    <div class="clear"></div>
    <script type="text/javascript">
        $("#create_new_carousel").on('click',function(){
            var platform = $("#platform_type").val();
            window.location.href = "/Carousel/addCarousel/platform/"+platform;
        });
        
        //获取url中的参数
        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null)
                return unescape(r[2]);
            return null; //返回参数值
        }
        get_list(1);
        function get_list(platform_type) {
            $('input[name=platform_type]').val(platform_type);
            var url = mkUrl();
            var p = getUrlParam('p');
            if (p != null) {
                var purl = "?p=" + p;
            } else {
                var purl = "?p=1";
            }
            $.get("/Carousel/carouselList/platform/"+platform_type + purl, url, function (data) {
                $("#listBox").html(data);
            }, "html");
        }
        function get_page(p) {
            var platform_type = $("#platform_type").val();
            var url = mkUrl();
            $.get("/Carousel/carouselList/platform/"+ platform_type + '/' + encodeURI("p/" + p), url, function (data) {
                $("#listBox").html(data);
            }, "html");
        }

        $("input[name='focus_search']").click(function () {
            var platform_type = $("#platform_type").val();
            get_list(platform_type);
        });

        function mkUrl() {
            var url = "";
            var c_id = $("input[name='c_id']").val();
            var type = $("#carousel_type option:selected").val();
            var start_time = $("input[name='start_time']").val();
            var end_time = $("input[name='end_time']").val();
            var sort = $("input[name='sort']").val();
            var remark = $("input[name='remark']").val();
            var status = $("#carousel_status option:selected").val();
            var platform = $("#platform option:selected").val();

            if (c_id) {
                url += '&c_id=' + c_id;
            }
            if (type) {
                url += '&type=' + type;
            }
            if (start_time) {
                url += '&start_time=' + start_time;
            }
            if (end_time) {
                url += '&end_time=' + end_time;
            }
            if (sort) {
                url += '&sort=' + sort;
            }
            if (remark) {
                url += '&remark=' + remark;
            }
            if (status) {
                url += '&status=' + status;
            }
            if (platform) {
                url += '&platform=' + platform;
            }
            return url;
        }

        /**
         * 确认操作
         * @returns {Boolean}
         */

//        function confirm_change_carousel_status(c_id, sort, status) {
//            confirm_popup('<div style="color:red">' + msg + '</div>', confirm(c_id, sort, status));
//        }
        function confirm_popup(c_id, sort, status, text,platform) {
            if (status == '1') {
                msg = "确认上线该焦点图？";
                htext = "上线焦点图";
            } else {
                msg = "确认下线该焦点图？";
                htext = "下线焦点图";
            }
            text = '<div style="color:red">' + msg + '</div>';
            var html = '<div class="chenggong1">\n\
                        <span class="paidan"><h3>' + htext + '</h3>' + text + '</span>\n\
                        <div class="shenhei-btn"><input type="button" value="确定" class="determine" />\n\
                        <input type="button" value="取消" class="cancel" onclick="colse_hide()" />\n\
                        </div></div>';
            $(".yunBei").css("display", "block");
            $(document.body).append(html);
            $(".chenggong1").fadeIn();
            confirm(c_id, sort, status,platform);
        }
        function confirm(c_id, sort, status,platform) {
            $('.determine').click(function () {
                colse_hide();
                change_carousel_status(c_id, sort, status,platform);
            });
        }

        /**
         * 上下、下线操作
         * @param {type} c_id
         * @param {type} status
         * @returns {Boolean}
         */
        function change_carousel_status(c_id, sort, status,platform) {
            var post_data = {c_id: c_id, sort: sort, status: status, platform: platform};
            $.post('/Carousel/changeCarouselStatus', post_data, function (res) {
                if (res.code == 200) {
                    delay_alert('操作成功!');
                    setTimeout(function () {
                        window.location.reload();
                    }, 500);
                } else {
                    delay_alert(res.msg);
                }
            }, 'json');
            return false;
        }

        $("#carousel_start_time").ymdateplugin({
            showTimePanel: true,
            changeMonth: true,
            changeYear: true
        });
        $("#carousel_end_time").ymdateplugin({
            showTimePanel: true,
            changeMonth: true,
            changeYear: true
        });
    </script>
    <div class="yunBei"></div>
<div class="loading"></div>
</body>
</html>